{% extends 'base.html' %}
{% block content%}

    <div class="grid_3">
        <div style="text-align:center;">
        <p>{% if previous_year %}<strong><a href="{% url repairs_month previous_year 1 %}"> <<< </a></strong>{% endif %}
            <strong style="font-size:20px;">{{ month.year }}</strong>
           {% if next_year %}<strong><a href="{% url repairs_month next_year 1 %}"> >>> </a></strong>{% endif %}
        </p>
        </div>

<div>
        <table>
        {% for mon in m_list %}
            {% cycle "<tr><td>" "<td>" %}
            {% if mon.month == month.month %} <strong class="baton disabled" disabled="True">{{ mon|date:"F" }}</strong>

            {% else %}
            <a href="{% url repairs_month month.year mon.month %}"><strong class="baton">{{ mon|date:"F" }}</strong></a>
            {% endif %}
            {% cycle "</td>" "</td></tr>" %}
        {% endfor %}
        </table>
</div>
    <div>
    <br><br>
    </div>
    </div>

    <div class=grid_8>
    <table class="tablr">
    {% for item in object_list %}
            <tr>
                <td><strong style="font-size:16px; color:{% if item.is_holiday %}ReD{% else %}GrEeN{% endif %};">{{ item.start }}&nbsp;-&nbsp;{{ item.end }}</strong></td>
                <td>{% if user.is_superuser %}
                    <a href="{% url repairs_update item.id %}"><img src="{{ MEDIA_URL }}images/edt.png"></a>
                {% endif %}
                &nbsp;
                {% if user.is_superuser %}
                        <a href="{% url export_by_repair item.id %}"><img src="{{ MEDIA_URL }}images/otchet_s.jpg"></a>&nbsp;
                        <a href="{% url export_by_repair_root item.id %}"><img src="{{ MEDIA_URL }}images/otchet_s.jpg"></a>
                {% endif %}

            &nbsp;
                {% if user.get_profile.unit_access and item.give_access or user.is_superuser %}
                        <a href="{% url repairs_add item.id user.get_profile.get_unit %}"
                           onClick="window.open(this.href, 'newWin', 'Toolbar=0, Location=0, Directories=0, Status=0, Menubar=0, Scrollbar=no , Resizable=1, Copyhistory=1, Height=800'); return false;"
                                ><img src="{{ MEDIA_URL }}images/personal.png"></a>
                {% endif %}</td>
            </tr>
    {% empty %}
                <tr><td>Ремонтов за {{ month|date:"F Y"}} года нет</td></tr>
    {% endfor %}
    {% if user.is_superuser %}
        <tr><td style="text-align:center; padding:10px 0;" colspan="2" ><a href="{% url repairs_create %}"><img src="{{ MEDIA_URL }}images/add.png"></a></td></tr>
    {% endif %}
    </table>
    </div>

{% endblock%}